package com.lemon.mapper.lemon;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.lemon.model.LemonScripts;

/**
 * @author lemon
 */
@Mapper
public interface LemonScriptsMapper extends BaseMapper<LemonScripts> {

    @Select("select * from lemon_scripts t where t.id = #{id}")
    LemonScripts getById(Long id);

    @Delete("delete from lemon_scripts where id = #{id}")
    int delete(LemonScripts lemonScripts);

    int update(LemonScripts lemonScripts);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into lemon_scripts(path, create_time, update_time, deleted, status) values(#{path}, #{createTime}, #{updateTime}, #{deleted}, #{status})")
    int save(LemonScripts lemonScripts);

    int count(@Param("params") Map<String, Object> params);

    List<LemonScripts> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

}
